﻿@model IEnumerable<BookManager.Models.BookModel>

<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>图书列表</title>

    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f7f6;
            color: #333;
            padding: 20px;
        }

        h2 {
            text-align: center;
            margin-bottom: 30px;
            color: #2c3e50;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            background-color: #fff;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }

        th,
        td {
            padding: 8px 12px;
            text-align: left;
            border: 1px solid #ddd;
        }

        th {
            background-color: #3498db;
            color: white;
            font-weight: bold;
        }

        td {
            background-color: #f9f9f9;
        }

            td button {
                padding: 6px 12px;
                font-size: 14px;
                margin: 2px;
                border-radius: 4px;
                border: none;
                cursor: pointer;
                transition: background-color 0.3s ease;
            }

                td button:hover {
                    opacity: 0.8;
                }

        .add-btn {
            background-color: #2ecc71;
            color: white;
            padding: 10px 20px;
            font-size: 16px;
            border-radius: 5px; 
            text-align: center;
            margin-bottom: 20px;
            cursor: pointer;
            border: none;
            transition: background-color 0.3s ease;
        }

            .add-btn:hover {
                background-color: #27ae60;
            }

        .delete-btn {
            background-color: #e74c3c;
            color: white;
        }

        .edit-btn {
            background-color: #f39c12;
            color: white;
        }

        .no-data {
            text-align: center;
            font-size: 18px;
            color: #999;
        }

        table {
            border-radius: 8px; 
            overflow: hidden;
        }

        th,
        td {
            border-radius: 0; 
        }
    </style>
</head>

<body>
    <h2>图书列表</h2>
    @using (Html.BeginForm("AddBook", "Home", FormMethod.Get))
    {
        <button type="submit" class="add-btn">添加图书</button>
    }

    @using (Html.BeginForm("PageNavigation", "Home", FormMethod.Get))
    {
        <button type="submit" class="add-btn">返回首页</button>
    }

    <table>
        <thead>
            <tr>
                <th>记录id</th>
                <th>书名</th>
                <th>借阅学号</th>
                <th>借阅日期</th>
                <th>备注内容</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var book in Model)
            {
                <tr>
                    <td>@book.borrow_id</td>
                    <td>@book.book_tile</td>
                    <td>@book.stu_num</td>
                    <td>@book.creat_date</td>
                    <td>@book.remark</td>
                    <td>
                        @using (Html.BeginForm("DelBook", "Home", new { id = book.borrow_id }, FormMethod.Post))
                        {
                            <button type="submit" class="delete-btn">删除</button>
                        }
                    </td>
                </tr>
            }
        </tbody>
    </table>
</body>

</html>
